package fr.appliClient.server.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "UTILISATEUR")
public class User implements AbstractEntity<Long>, Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id_utilisateur")
	private Long id;

	@Column
	private String name;

	@Column
	private boolean responsible = false;

	@OneToMany(mappedBy = "user")
	private List<Vehicle> userVehicles;

	@OneToMany(mappedBy = "responsible")
	private List<Vehicle> responsibleVehicles;

	public User() {

		userVehicles = new ArrayList<Vehicle>();
		responsibleVehicles = new ArrayList<Vehicle>();
	}

	public String getName() {

		return name;
	}

	public void setName(String name) {

		this.name = name;
	}

	public boolean isResponsible() {

		return responsible;
	}

	public void setResponsible(boolean responsible) {

		this.responsible = responsible;
	}

	public List<Vehicle> getUserVehicles() {

		return userVehicles;
	}

	public void setUserVehicles(List<Vehicle> userVehicles) {

		this.userVehicles = userVehicles;
	}

	public List<Vehicle> getResponsibleVehicles() {

		return responsibleVehicles;
	}

	public void setResponsibleVehicles(List<Vehicle> responsibleVehicles) {

		this.responsibleVehicles = responsibleVehicles;
	}

	public Long getId() {

		return id;
	}

}
